package com.infindo.appcreate.zzyj.service;

import java.util.HashSet;
import java.util.Set;

import org.springframework.dao.DataAccessException;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

public class UserDetailsServiceImpl implements UserDetailsService {

	public UserDetails loadUserByUsername(String email)
			throws UsernameNotFoundException, DataAccessException {
		// UserInfo user = loadUserByEmail(email);
		// if (user == null) {
		// throw new UsernameNotFoundException((new StringBuilder())
		// .append("the user '").append(email)
		// .append("' dont't exist").toString());
		// } else {
		// Set<GrantedAuthority> grantedAuths = obtainGrantedAuthorities(user);
		// boolean credentialsNonExpired = true;
		// boolean accountNonLocked = !user.getLocked().booleanValue();
		// boolean accountNonExpired = !user.getExpired().booleanValue();
		// UserInfo userDetails = new UserInfo();
		// userDetails.setUsername(user.getUserName());
		// return userDetails;
		// }
		return null;
	}

	private Set<GrantedAuthority> obtainGrantedAuthorities(Long userId) {

		Set<GrantedAuthority> authSet = new HashSet<GrantedAuthority>();
		return authSet;
	}

}
